<template>
	<view class="boxs">
		<!-- 出租房 -->
		<view class="rent">
			<view class="box">
				<!-- 所在小区 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">所在小区</text>
					</view>
					<view class="hrs" @click="housename2">
						<text class="plotbname">{{data2.housenames2 || data2.community_name}}</text>
						<image src="https://fangguaner.wm76.mtnet.ren/static/applet/right.png" mode="" class="right">
						</image>
					</view>
				</view>

				<!-- 租房名称 -->
				<view class="plotboxs">
					<view class="left">
						<text class="plot">租房名称</text>
					</view>
					<view class="hrs">
						<input type="text" :value="up=='修改'?data2.name:''" placeholder="如:xx小区 近地铁 中楼层 满五套三"
							@input="rentname" />
					</view>
				</view>


				<!-- 租房名称 -->
				<view class="plotboxs">
					<view class="left">
						<text class="plot">每月租金</text>
					</view>
					<view class="hrss">
						<input type="digit" :value="data2.price" placeholder="如:2000" @input="rentprice" />
					</view>
					<view class="price">
						元/月
					</view>
				</view>


				<!-- 建筑面积 -->
				<view class="plotboxs">
					<view class="left">
						<text class="plot">建筑面积</text>
					</view>
					<view class="hrss">
						<input type="digit" :value="data2.building_area" placeholder="如:100" @input="areas" />
					</view>
					<view class="price">
						㎡
					</view>
				</view>


				<!-- 楼层 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">楼&nbsp&nbsp&nbsp&nbsp层</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in the_floor" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.the_floor==item.name?'checked':''"
									:checked="data2.the_floor==item.name?true:false" @click="selcfour(item)"></radio>
								<text>{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>


				<view class="plotboxs">
					<view class="department">
						所属楼层
					</view>
					<view class="transverse">
						<input type="number" :value="data2.floor" placeholder="如:20" @input="floorss" />
					</view>
					<view class="department">
						总楼层
					</view>
					<view class="transverse">
						<input type="number" :value="data2.total_floors" placeholder="如:30" @input="allfloos" />
					</view>
				</view>


				<!-- 出租方式 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">出租方式</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in rent_type" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.rent_type==item.name?'checked':''"
									:checked="data2.rent_type==item.name?true:false" @click="selcone(item)"></radio>
								<text>{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>


				<!-- 房屋租期 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">房屋租期</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in rent_term" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.rent_term==item.name?'checked':''"
									:checked="data2.rent_term==item.name?true:false" @click="selctwo(item)"></radio>
								<text>{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>


				<!-- 付款方式 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">付款方式</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in payType" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.pay_type==item.id?'checked':''"
									:checked="data2.pay_type==item.id?true:false"
									@click="selectBase1('pay_type', 'id', item)"></radio>
								<text>{{item.text}}</text>
							</view>
						</view>
					</view>
				</view>

				<!-- 是否有燃气 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">是否有燃气</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in have_gas" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.have_gas==item.id?'checked':''"
									:checked="data2.have_gas==item.id?true:false"
									@click="selectBase1('have_gas', 'id', item)"></radio>
								<text>{{item.text}}</text>
							</view>
						</view>
					</view>
				</view>

				<!-- 是否有车位 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">是否有车位</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in have_parking" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.have_parking==item.id?'checked':''"
									:checked="data2.have_parking==item.id?true:false"
									@click="selectBase1('have_parking', 'id', item)"></radio>
								<text>{{item.text}}</text>
							</view>
						</view>
					</view>
				</view>

				<!-- 朝向 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">朝向</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in orientation" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.orientation==item.name?'checked':''"
									:checked="data2.orientation==item.name?true:false"
									@click="selectBase1('orientation', 'name', item)"></radio>
								<text>{{item.text || item.name}}</text>
							</view>
						</view>
					</view>
				</view>


				<!-- 房源亮点 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">房源亮点</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in house_bright" :key="index">
							<view class="cu-form-group">
								<radio class='red radio'
									:class="data2.house_bright.indexOf(item.name) > -1 ?'checked':''"
									:checked="data2.house_bright.indexOf(item.name) > -1?true:false"
									@click="selectBase1('house_bright', 'name', item, true)"></radio>
								<text>{{item.text || item.name}}</text>
							</view>
						</view>
					</view>
				</view>


				<!-- 配套设施 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">配套设施</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in facilities" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.facilities.indexOf(item.id) > -1 ?'checked':''"
									:checked="data2.facilities.indexOf(item.id) > -1?true:false"
									@click="selectBase1('facilities', 'id', item, true)"></radio>
								<text>{{item.text || item.name}}</text>
							</view>
						</view>
					</view>
				</view>


				<!-- 是否电梯 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">是否电梯</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in elevator" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.elevator==item.name?'checked':''"
									:checked="data2.elevator==item.name?true:false" @click="rentelevator(item)">
								</radio>
								<text>{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>

				<!-- 是否权属核验 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">是否权属核验</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in ownership" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.ownership==item.name?'checked':''"
									:checked="data2.ownership==item.name?true:false" @click="selcfive(item)"></radio>
								<text>{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>

				<!-- 装修标准 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">装修标准</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in decorate" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.decorate==item.name?'checked':''"
									:checked="data2.decorate==item.name?true:false" @click="selcsix(item)"></radio>
								<text>{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>

				<!-- <view class="plotboxs">
					<view class="left">
						<text class="plot">房源编码</text>
					</view>
					<view class="hrs">
						<input type="number" v-model="data2.serial_number" />
					</view>
				</view> -->
				<view class="plotboxs">
					<view class="left">
						<text class="plot">供&nbsp&nbsp&nbsp&nbsp水</text>
					</view>
					<view class="hrs">
						<input type="number" v-model="data2.water_supply" placeholder="如:(有供水/无供水)" />
					</view>
				</view>
				<view class="plotboxs">
					<view class="left">
						<text class="plot">供&nbsp&nbsp&nbsp&nbsp暖</text>
					</view>
					<view class="hrs">
						<input type="number" v-model="data2.heating_supply" placeholder="如:(有供暖/无供暖)" />
					</view>
				</view>
				<view class="plotboxs">
					<view class="left">
						<text class="plot">供&nbsp&nbsp&nbsp&nbsp电</text>
					</view>
					<view class="hrs">
						<input type="number" v-model="data2.power_supply" placeholder="如:(有供电/无供电)" />
					</view>
				</view>


				<!-- 户型 -->
				<view class="plotboxs">
					<view class="department">
						户&nbsp&nbsp&nbsp&nbsp型
					</view>
					<view class="transverses" @click="housetype('show3')">
						<view type="text" value="" class="style">{{list3[textfrou[0]].label || data2.room}}</view>
						<view class="angle"></view>
					</view>室
					<view class="transverses" @click="housetype('show4')">
						<view type="text" value="" class="style">{{list4[textfive[0]].label || data2.hall}}</view>
						<view class="angle"></view>
					</view>厅
					<view class="transverses" @click="housetype('show5')">
						<view type="text" value="" class="style" style="text-align: center;">
							{{list5[textsix1[0]].label || data2.rest_room}}
						</view>
						<view class="angle"></view>
					</view>卫
				</view>

				<u-select v-model="show3" mode="single-column" :list="list3" @confirm="confirm3"
					:default-value="textfrou"></u-select>
				<u-select v-model="show4" mode="single-column" :list="list4" @confirm="confirm4"
					:default-value="textfive"></u-select>
				<u-select v-model="show5" mode="single-column" :list="list5" @confirm="confirm5"
					:default-value="textsix1"></u-select>




				<!-- 房型 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">房&nbsp&nbsp&nbsp&nbsp型</text>
					</view>
					<view class="cekname" style="display: flex;">
						<view class="show" v-for="(item,index) in house_type" :key="index">
							<view class="cu-form-group">
								<radio class='red radio' :class="data2.house_type==item.name?'checked':''"
									:checked="data2.house_type==item.name?true:false" @click="rentselcthree(item)">
								</radio>
								<text>{{item.name}}</text>
							</view>
						</view>
					</view>
				</view>


				<!-- 房屋封面 -->
				<view class="plotboxs">
					<view class="left">
						<text class="plot">房屋封面</text>
					</view>
					<UpLoadimg @successImg="successImg3" :imgList="data2.imgList3" @deleteImg="deleteImg3"></UpLoadimg>
				</view>

				<!-- 详情图片 -->
				<view class="plotboxs">
					<view class="left">
						<text class="plot">详情图片</text>
					</view>
					<UpLoadimg @successImg="successImg4" :imgList="data2.imgList4" @deleteImg="deleteImg4"
						:imgMaxNum="10">
					</UpLoadimg>
				</view>


				<!-- 保安管理 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">保安管理</text>
					</view>
					<view class="hrs" @click="police">
						<text class="plotbname">{{data2.policename2 || data2.guard_name}}</text>
						<image src="https://fangguaner.wm76.mtnet.ren/static/applet/right.png" mode="" class="right">
						</image>
					</view>
				</view>



				<!-- 标签管理 -->
				<view class="plotbox">
					<view class="left">
						<text class="plot">标签管理</text>
					</view>
					<view class="hrs">
						<BaseLabel ref="baseLabel" :arr="data2.biaoqian" :arr1="data2.selectbiaoqian1"
							@selectItem="selectItem1" @shuruItem="shuruItem1"></BaseLabel>
					</view>
				</view>
				
				<view class="plotbox">
					<view class="left">
						<text class="plot">是否显示业主信息</text>
					</view>
					<view class="cekname" style="margin-left: 20rpx;">
						<switch @change="switch2Change" :checked="data2.landlord==1?true:false" />
					</view>
				</view>

				<view class="plotboxs">
					<view class="left">
						<text class="plot">业主姓名</text>
					</view>
					<view class="hrs">
						<input type="text" :value="data2.contact" @input="rentcontact" />
					</view>
				</view>

				<view class="plotboxs">
					<view class="left">
						<text class="plot">业主电话</text>
					</view>
					<view class="hrs">
						<input type="number" :value="data2.contact_number" @input="rentnum" />
					</view>
				</view>

				<view class="plotboxs">
					<view class="left">
						<text class="plot">备&nbsp&nbsp&nbsp&nbsp注</text>
					</view>
					<textarea :value="data2.remark" placeholder="备注" @input="rentdescribe" />
				</view>
				


				<view class="plotboxs">
					<view class="left">
						<text class="plot">看房说明</text>
					</view>
					<textarea :value="data2.see_house" placeholder="看房说明" @input="rentdessee_house" />
				</view>


				
			</view>
		</view>
		<view class="basebtn" v-if="up!='修改'">
			<view class="uploads" @click="housesave">
				保存
			</view>
			<view class="upload" @click="upload">
				发布
			</view>
		</view>
		<view class="basebtns" v-if="up=='修改'">
			<view class="uploads" @click="savelist">
				保存
			</view>
		</view>
		
		
		<u-popup v-model="popshow" mode="center">
			<view class="reason">
				审核未通过原因
			</view>
			<view class="tangchubox">
				<view class="submits">
					{{data2.reason}}
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import BaseLabel from "../../components/BaseLabel/BaseLabel.vue"
	import {
		getselect,
		uploadfiles,
		getlabel,
		getfinishhouse,
		getPtSS,
		gethousefinish
	} from "../../api/api/index.js"
	import {
		baseUrl
	} from "../../api/request.js"
	import {
		upUrl
	} from "../../api/request.js"
	import UpLoadimg from "../../components/UpLoadimg/index.vue"
	export default {
		data() {
			return {
				flag: false,
				up:"",
				popshow:false,
				// 付款方式
				payType: [{
					text: "月付",
					id: 1
				}, {
					text: "季付",
					id: 2
				}, {
					text: "半年付",
					id: 3
				}, {
					text: "年付",
					id: 4
				}],
				// 是否有燃气
				have_gas: [{
					text: "是",
					id: 1
				}, {
					text: "否",
					id: 0
				}],
				// 是否有车位
				have_parking: [{
					text: "是",
					id: 1
				}, {
					text: "否",
					id: 0
				}],
				orientation: [], //朝向
				house_bright: [], //房源亮点
				facilities: [], //配套设置
				data2: {
					pay_type: 0, //--付款方式   1=月付   2=季付   3=半年付   4=年付
					orientation: '', //朝向
					see_house: "", //看房说明
					house_bright: [], //房源亮点
					serial_number: '', //房源编码
					facilities: [], //配套设施
					water_supply: '', //供水
					heating_supply: '', //供暖
					power_supply: '', //供电
					have_gas: 0, //是否有燃气
					have_parking: 0, //是否有车位
					action: "add",
					type: 2,
					community_id: 0,
					name: "",
					image: "",
					banner: "",
					guard_id: 0,
					label: "",
					remark: "",
					price: "",
					contact: "",
					contact_number: "",
					house_type: "",
					room: "",
					hall: "",
					rest_room: "",
					building_area: "",
					landlord: 0,
					rent_type: "",
					rent_term: "",
					elevator: "",
					the_floor: "",
					ownership: "",
					decorate: "",
					total_floors: "",
					floor: "",
					housenames2: "",
					policename2: "",
					biaoqian: [],
					imgList3: [],
					imgList4: [],
					selectbiaoqian1: [],
					id: ""
				},
				build_type: [],
				orientation: [],
				ownership: [],
				purpose: [],
				ownerships: [],

				// 二手房封面上传
				imgList: [],
				imgArr: "",

				// 判断二手房还是出租房
				type: "二手房",
				// 二手房封面
				action: upUrl,
				fileList: [],
				// 二手房详情图片
				action1: upUrl,
				fileList1: [],
				house_features: [],





				rentid: 0,

				// 房型
				house_type: [],
				// 是否显示业主信息
				showarr: [{
					text: "否",
					id: 0
				}, {
					text: "是",
					id: 1
				}],
				bool: true,
				arr: [{
					text: "二手房"
				}, {
					text: "租房"
				}],
				currentindex: 0,
				// 封面图片
				imgList: [],
				imgArr: "",
				// 详情图片
				imgLists: [],
				imgArrs: "",
				// 详情图片
				imgListone: [],
				imgArrone: "",
				imgListtwo: [],
				imgArrtwo: "",
				// 出租房出租方式
				rent_type: [],
				// 租房租期
				rent_term: [],
				// 是否电梯
				elevator: [],
				// 楼层
				the_floor: [],

				// 是否权属核验
				arr6: [{
					text: "否"
				}, {
					text: "是"
				}],
				// 装修标准
				decorate: [],

				// 下拉框
				show: false,
				show1: false,
				show2: false,
				show3: false,
				show4: false,
				show5: false,
				list: [{
						value: '1',
						label: '1'
					},
					{
						value: '2',
						label: '2'
					}, {
						value: '3',
						label: '3'
					},
					{
						value: '4',
						label: '4'
					}
				],
				list1: [{
						value: '1',
						label: '1'
					},
					{
						value: '2',
						label: '2'
					}, {
						value: '3',
						label: '3'
					},
					{
						value: '4',
						label: '4'
					}
				],
				list2: [{
						value: '1',
						label: '1'
					},
					{
						value: '2',
						label: '2'
					}, {
						value: '3',
						label: '3'
					},
					{
						value: '4',
						label: '4'
					}
				],

				list3: [{
						value: '1',
						label: '1'
					},
					{
						value: '2',
						label: '2'
					}, {
						value: '3',
						label: '3'
					},
					{
						value: '4',
						label: '4'
					}
				],
				list4: [{
						value: '1',
						label: '1'
					},
					{
						value: '2',
						label: '2'
					}, {
						value: '3',
						label: '3'
					},
					{
						value: '4',
						label: '4'
					}
				],
				list5: [{
						value: '1',
						label: '1'
					},
					{
						value: '2',
						label: '2'
					}, {
						value: '3',
						label: '3'
					},
					{
						value: '4',
						label: '4'
					}
				],
				textone: [],
				texttwo: [],
				textthree: [],
				textfrou: [],
				textfive: [],
				textsix1: [],

			}
		},
		components: {
			BaseLabel,
			UpLoadimg
		},
		methods: {
			switch2Change(e) {
				if (e.detail.value) {
					this.data2.landlord = 1
				} else {
					this.data2.landlord = 0
				}
			},
			//所有选中的点击
			selectBase1(name, id, item, isMush) {
				if (isMush) { //多选
					let index = this.data2[name].indexOf(item[id])
					if (index > -1) {
						this.data2[name].splice(index, 1)
					} else {
						this.data2[name].push(item[id])
					}
				} else {
					if (this.data2[name] != item[id]) {
						this.data2[name] = item[id]
					} else {
						this.data2[name] = ""
					}

				}
			},
			rentdessee_house(e) {
				this.data2.see_house = e.detail.value
			},
			// 出租房输入框
			rentname(e) {
				this.data2.name = e.detail.value
			},
			rentprice(e) {
				this.data2.price = e.detail.value
			},
			areas(e) {
				this.data2.building_area = e.detail.value
			},
			selcfour: function(item) {
				if (this.data2.the_floor != item.name) {
					this.data2.the_floor = item.name
				} else {
					this.data2.the_floor = ""
				}

			},
			floorss(e) {
				this.data2.floor = e.detail.value
			},
			allfloos(e) {
				this.data2.total_floors = e.detail.value
			},
			// 出租方式
			selcone: function(item) {
				if (this.data2.rent_type != item.name) {
					this.data2.rent_type = item.name
				} else {
					this.data2.rent_type = ""
				}
			},
			selctwo: function(item) {
				if (this.data2.rent_term != item.name) {
					this.data2.rent_term = item.name
				} else {
					this.data2.rent_term = ""
				}
			},
			rentelevator(item) {
				if (this.data2.elevator != item.name) {
					this.data2.elevator = item.name
				} else {
					this.data2.elevator = ""
				}

			},
			selcfive: function(item) {
				if (this.data2.ownership != item.name) {
					this.data2.ownership = item.name
				} else {
					this.data2.ownership = ""
				}

			},
			selcsix: function(item) {
				if (this.data2.decorate != item.name) {
					this.data2.decorate = item.name
				} else {
					this.data2.decorate = ""
				}

			},
			rentselcthree(item) {
				if (this.data2.house_type != item.name) {
					this.data2.house_type = item.name
				} else {
					this.data2.house_type = item.name
				}

			},
			// 出租房是否显示业主信息
			showss(item) {
				if (this.data2.landlord != item.id) {
					this.data2.landlord = item.id
				} else {
					this.data2.landlord = ""
				}
			},
			confirm3(e) {
				this.list.forEach((item, index) => {
					if (item.value == e[0].value) {
						this.data2.room = e[0].label
						this.textfrou = [index]
					}
				})
			},
			confirm4(e) {
				this.list.forEach((item, index) => {
					if (item.value == e[0].value) {
						this.data2.hall = e[0].label
						this.textfive = [index]
					}
				})
			},

			confirm5(e) {
				this.list.forEach((item, index) => {
					if (item.value == e[0].value) {
						this.data2.rest_room = e[0].label
						this.textsix1 = [index]
					}
				})
			},
			rentcontact(e) {
				this.data2.contact = e.detail.value
			},
			rentnum(e) {
				this.data2.contact_number = e.detail.value
			},
			rentdescribe(e) {
				this.data2.remark = e.detail.value
			},
			successImg3(data) {
				this.data2.imgList3.push(data)
			},
			deleteImg3(index) {
				this.data2.imgList3.splice(index, 1)
			},
			successImg4(data) {
				this.data2.imgList4.push(data)
			},

			deleteImg4(index) {
				this.data2.imgList4.splice(index, 1)
			},

			// 出租房选择标签
			selectItem1(item) {
				const index = this.data2.selectbiaoqian1.indexOf(item.id);
				if (index > -1) {
					this.data2.selectbiaoqian1.splice(index, 1)
				} else {
					this.data2.selectbiaoqian1.push(item.id)
				}
				let a = []
				this.data2.biaoqian.forEach(v => {
					if (this.data2.selectbiaoqian1.indexOf(v.id) !== -1) {
						a.push(v.text)
					}
				})
				this.data2.label = a.join("|")

			},
			shuruItem1(e) {
				if (e.id != "") {
					this.data2.biaoqian.push(e)
					this.$refs.baseLabel.zhi = '自定义'
				} else {
					return
				}
			},

			rentdessee_house(e) {
				this.data2.see_house = e.detail.value
			},
			housename2() {
				this.jumpLink({
					link: "/pages/department/index",
					query: {
						'type': "租房"
					}
				})
			},

			// 二手房户型
			housetype(name) {
				this.show = false
				this.show1 = false
				this.show2 = false
				this.show3 = false
				this.show4 = false
				this.show5 = false
				this[name] = true
			},
			police() {
				this.jumpLink({
					link: "/pages/Securitymanagement/index",
					query: {
						'type': "租房"
					}
				})
			},


			// 上传房源发布
			upload() {
				let data4 = {}
				let a = []
				if (this.data2.imgList3.length != 0 && this.data2.imgList4.length != 0) {
					for (let i = 0; i < this.data2.imgList4.length; i++) {
						a.push(this.data2.imgList4[i].url)
					}
					data4 = {
						action: "edit", //方式
						type: 2,
						community_id: this.data2.community_id,
						name: this.data2.name,
						price: this.data2.price,
						building_area: this.data2.building_area,
						elevator: this.data2.elevator,
						the_floor: this.data2.the_floor,
						image: this.data2.imgList3[0].url, //封面一张
						banner: a.join("|"), //banner图
						serial_number: this.data2.serial_number, //房源编码
						label: this.data2.label,
						remark: this.data2.remark,
						floor: this.data2.floor,
						total_floors: this.data2.total_floors,
						landlord: this.data2.landlord,
						contact: this.data2.contact,
						contact_number: this.data2.contact_number,
						house_type: this.data2.house_type,
						room: this.data2.room,
						hall: this.data2.hall,
						rest_room: this.data2.rest_room,
						orientation: this.data2.orientation,
						see_house: this.data2.see_house,
						status: 1, //0=保存    1=发布
						guard_id: this.data2.guard_id,
						id: this.data2.id,
						rent_type: this.data2.rent_type,
						rent_term: this.data2.rent_term,
						pay_type: this.data2.pay_type,
						have_gas: this.data2.have_gas,
						have_parking: this.data2.have_parking,
						house_bright: this.data2.house_bright,
						ownership: this.data2.ownership,
						decorate: this.data2.decorate,
						water_supply: this.data2.water_supply,
						heating_supply: this.data2.heating_supply,
						power_supply: this.data2.power_supply,
						facilities:this.data2.facilities,
						guard_house_id:this.data2.id
					}
					getfinishhouse(data4).then(res => {
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 1500,
							mask: true
						})
						setTimeout(function() {
							uni.navigateBack({})
						}, 1500)
					})
				} else {
					uni.showToast({
						title: "请将信息填写完整",
						icon: "none",
						duration: 1500
					})
				}
			},
			housesave() {
				let data4 = {}
				let a = []
				if (this.data2.imgList3.length != 0 && this.data2.imgList4.length != 0) {
					for (let i = 0; i < this.data2.imgList4.length; i++) {
						a.push(this.data2.imgList4[i].url)
					}
					data4 = {
						action: "edit", //方式
						type: 2,
						community_id: this.data2.community_id,
						name: this.data2.name,
						price: this.data2.price,
						building_area: this.data2.building_area,
						elevator: this.data2.elevator,
						the_floor: this.data2.the_floor,
						image: this.data2.imgList3[0].url, //封面一张
						banner: a.join("|"), //banner图
						serial_number: this.data2.serial_number, //房源编码
						label: this.data2.label,
						remark: this.data2.remark,
						floor: this.data2.floor,
						total_floors: this.data2.total_floors,
						landlord: this.data2.landlord,
						contact: this.data2.contact,
						contact_number: this.data2.contact_number,
						house_type: this.data2.house_type,
						room: this.data2.room,
						hall: this.data2.hall,
						rest_room: this.data2.rest_room,
						orientation: this.data2.orientation,
						see_house: this.data2.see_house,
						status: 0, //0=保存    1=发布
						guard_id: this.data2.guard_id,
						rent_type: this.data2.rent_type,
						rent_term: this.data2.rent_term,
						pay_type: this.data2.pay_type,
						have_gas: this.data2.have_gas,
						have_parking: this.data2.have_parking,
						house_bright: this.data2.house_bright,
						ownership: this.data2.ownership,
						decorate: this.data2.decorate,
						water_supply: this.data2.water_supply,
						heating_supply: this.data2.heating_supply,
						power_supply: this.data2.power_supply,
						facilities:this.data2.facilities,
						guard_house_id:this.data2.id
					}
					getfinishhouse(data4).then(res => {
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 1500,
							mask: true
						})
						setTimeout(function() {
							uni.navigateBack({})
						}, 1500)
					})
				} else {
					uni.showToast({
						title: "请将信息填写完整",
						icon: "none",
						duration: 1500
					})
				}
			},
			
			// 修改时候保存
			savelist(){
				let data4 = {}
				let a = []
				if (this.data2.imgList3.length != 0 && this.data2.imgList4.length != 0) {
					for (let i = 0; i < this.data2.imgList4.length; i++) {
						a.push(this.data2.imgList4[i].url)
					}
					data4 = {
						action: "update", //方式
						type: 2,
						community_id: this.data2.community_id,
						name: this.data2.name,
						price: this.data2.price,
						building_area: this.data2.building_area,
						elevator: this.data2.elevator,
						the_floor: this.data2.the_floor,
						image: this.data2.imgList3[0].url, //封面一张
						banner: a.join("|"), //banner图
						serial_number: this.data2.serial_number, //房源编码
						label: this.data2.label,
						remark: this.data2.remark,
						floor: this.data2.floor,
						total_floors: this.data2.total_floors,
						landlord: this.data2.landlord,
						contact: this.data2.contact,
						contact_number: this.data2.contact_number,
						house_type: this.data2.house_type,
						room: this.data2.room,
						hall: this.data2.hall,
						rest_room: this.data2.rest_room,
						orientation: this.data2.orientation,
						see_house: this.data2.see_house,
						guard_id: this.data2.guard_id,
						id: this.data2.id,
						rent_type: this.data2.rent_type,
						rent_term: this.data2.rent_term,
						pay_type: this.data2.pay_type,
						have_gas: this.data2.have_gas,
						have_parking: this.data2.have_parking,
						house_bright: this.data2.house_bright,
						ownership: this.data2.ownership,
						decorate: this.data2.decorate,
						water_supply: this.data2.water_supply,
						heating_supply: this.data2.heating_supply,
						power_supply: this.data2.power_supply,
						facilities:this.data2.facilities
					}
					debugger
					getfinishhouse(data4).then(res => {
						uni.showToast({
							title: res.message,
							icon: "none",
							duration: 1500,
							mask: true
						})
						setTimeout(function() {
							uni.navigateBack({})
						}, 1500)
					})
				} else {
					uni.showToast({
						title: "请将信息填写完整",
						icon: "none",
						duration: 1500
					})
				}
			},


		},
		onLoad(e) {
			this.up = e.up
			gethousefinish({
				id: e.id
			}).then(res => {
				let datas = {
					...res.data,
					...res.data.house
				}
				this.data2 = {
					...this.data2,
					...datas
				}
				this.data2.facilities=this.data2.facilities.map(v=>{
					v = parseInt(v)
					return v
				})
				this.data2.selectbiaoqian1=this.data2.label
				// 判断是否弹出弹框
				if(this.data2.reason!=""){
					this.popshow=true
				}
				if(datas.banner){
					this.data2.imgList4 = res.data.house.banner.map(v => {
						return {
							url: v
						}
					})
					let image = []
					image.push(res.data.house.image)
					this.data2.imgList3 = image.map(v => {
						return {
							url: v
						}
					})
				}
			})
			getselect({
				type: 'house_type,elevator,the_floor,decorate,rent_type,rent_term,ownership,orientation,purpose,ownerships,build_type,house_features,house_bright'
			}).then(res => {
				this.elevator = res.data.elevator.child
				this.house_type = res.data.house_type.child
				this.the_floor = res.data.the_floor.child
				this.decorate = res.data.decorate.child
				this.rent_type = res.data.rent_type.child
				this.rent_term = res.data.rent_term.child
				this.ownership = res.data.ownership.child
				this.orientation = res.data.orientation.child
				this.purpose = res.data.purpose.child
				this.ownerships = res.data.ownerships.child
				this.build_type = res.data.build_type.child
				this.house_features = res.data.house_features.child
				this.house_bright = res.data.house_bright.child //房源亮点
			})

			getPtSS().then(res => {
				this.facilities = res.data
			})
			getlabel({
				type: 2
			}).then(res => {
				this.data2.biaoqian = res.data.map(v => {
					v.text = v.name
					v.id=v.name
					return v
				})
				console.log(this.data2.biaoqian)
			})
		},
		onShow() {
			setTimeout(() => {
				this.flag = true
			}, 1000)
			this.data2.community_id = this.$store.state.community_id
			this.data2.guard_id = this.$store.state.guard_id
			this.bool = false
			this.data2.policename2 = this.$store.state.plicname
			this.data2.housenames2 = this.$store.state.name

		},
		computed: {},
	}
</script>

<style scoped>
	.tangchubox {
		width: 500rpx;
		padding: 20rpx;
		box-sizing: border-box;
		height: 400rpx;
	}
	.reason {
		width: 100%;
		text-align: center;
		height: 50rpx;
		background-color: #f75653;
		line-height: 50rpx;
		color: #FFFFFF;
	}
	page {
		background-color: #FFFFFF;
	}

	.tangchubox {
		width: 500rpx;
		padding: 20rpx;
		box-sizing: border-box;
		height: 400rpx;
	}

	.boxs {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: #FFFFFF;
	}

	.cu-form-group {
		padding: 0 !important;
		display: flex !important;
		justify-content: space-between !important;
	}

	.top {
		display: flex;
		justify-content: space-between;
		margin-top: 49rpx;
		margin-left: 54rpx;
		margin-right: 100rpx;
	}

	.houseclass {
		color: #676767;
		width: 121rpx;
		height: 52rpx;
		text-align: center;
	}

	.specil {
		border-bottom: 7rpx solid #ce3d3a;
		color: #000000;
		font-weight: 700;
	}

	.hr {
		width: 100%;
		height: 1rpx;
		background-color: #e6e6e6;
	}



	.box {
		padding: 0 31rpx;
		box-sizing: border-box;
	}

	/* 所在小区 */
	.plotbox {
		display: flex;
		justify-content: space-between;
		margin-top: 66rpx;
	}

	.plot {
		font-size: 26rpx;
		font-family: MicrosoftYaHei;
		color: #000000;
	}

	.plotbname {
		font-family: MicrosoftYaHei;
		font-size: 26rpx;
		color: #666666;
		margin-left: 40rpx;
	}
	.basebtns>.uploads {
		margin: 30rpx auto;
		width: 500rpx;
	}
	.hrs>.right {
		width: 15rpx;
		height: 27rpx;
		margin-top: 10rpx;
		display: flex;
	}

	/* 房屋名称 */
	.plotboxs {
		display: flex;
		margin-top: 66rpx;
	}

	.hrs {
		border-bottom: 1rpx solid #999999;
		margin-left: 40rpx;
		width: 547rpx;
		display: flex;
		justify-content: space-between;
	}

	.hrs>input {
		width: 547rpx;
	}

	/* 房源价格 */
	.hrss {
		border-bottom: 1rpx solid #999999;
		margin-left: 40rpx;
		width: 469rpx;
	}

	.price {
		font-size: 26rpx;
		color: #282828;
		font-family: MicrosoftYaHei;
	}

	/* 所属楼层 */
	.department {
		font-family: MicrosoftYaHei;
		font-size: 26rpx;
		color: #000000;
	}

	.transverse {
		border-bottom: 1rpx solid #999999;
		margin-left: 40rpx;
		width: 200rpx;
	}

	/* 户型 */
	.transverses {
		border-bottom: 1rpx solid #999999;
		margin-left: 40rpx;
		width: 126rpx;
		display: flex;
		justify-content: space-between;
	}

	.transverses>.style {
		width: 110rpx;
		text-align: center;
	}

	.transverses>.angle {
		width: 0;
		height: 0;
		border-left: 10rpx solid transparent;
		border-right: 10rpx solid transparent;
		border-top: 10rpx solid black;
		margin-top: 20rpx;
	}

	.transverses>.style {
		font-size: 26rpx;
		color: #666666;
	}

	/* 封面上传 */
	.showimg_box {
		display: flex;
		flex-wrap: wrap;
	}

	.add {
		width: 100rpx;
		height: 100rpx;
		margin-left: 20rpx;
		margin-right: 20rpx;
		margin-bottom: 10rpx;
	}

	.adds {
		width: 100rpx;
		height: 100rpx;
		margin-right: 30rpx;
		margin-bottom: 10rpx;
	}


	.imgarr {
		align-items: center;
		position: relative;
	}

	.icon-cuo {
		position: absolute;
		right: 13rpx;
		top: -13rpx;
		z-index: 10009;
		border-radius: 50%;
		width: 36rpx;
		height: 36rpx;
	}

	.left {
		white-space: nowrap;
	}

	.basebtn {
		display: flex;
		justify-content: space-between;
		margin-left: 20rpx;
		margin-right: 20rpx;
	}

	.upload {
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		background-color: #fc7b63;
		border-radius: 5rpx;
		color: #FFFFFF;
		font-family: MicrosoftYaHei;
		font-size: 30rpx;
		width: 300rpx;
		margin-top: 82rpx;
		margin-bottom: 28rpx;
	}
	.uploads {
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		background-color: #F8B642;
		border-radius: 5rpx;
		color: #FFFFFF;
		font-family: MicrosoftYaHei;
		font-size: 30rpx;
		width: 300rpx;
		margin-top: 82rpx;
		margin-bottom: 28rpx;
	}

	/* 复选框 */
	.cekname {
		width: 90%;
		display: flex;
		flex-wrap: wrap;
	}

	.reason {
		width: 100%;
		text-align: center;
		height: 50rpx;
		background-color: #f75653;
		line-height: 50rpx;
		color: #FFFFFF;
	}

	.show {
		margin-top: -28rpx;
		margin-left: 20rpx;
	}

	/* 户型下拉框 */
	.housetype {
		position: relative;
	}

	.housetype .modelbox {
		position: absolute;
		top: 40rpx;
		left: 116rpx;
		background-color: #007AFF;
		width: 120rpx;
		text-align: center;
		z-index: 9999;
	}

	.modelbox view {
		height: 50rpx;
		line-height: 50rpx;
	}

	textarea {
		border: solid 2rpx #bebebe;
		border-radius: 20rpx;
		padding: 10rpx;
		box-sizing: border-box;
		margin-left: 23rpx;
	}
</style>
